<?php

use think\migration\Migrator;
use think\migration\db\Column;

class AppGpuPrice extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('app_gpu_price')
            ->setComment('')
            ->addColumn('create_time', 'integer', ['limit' => '11', 'signed' => '0', 'null' => '0', 'default' => '0', 'comment' => '创建时间', ])
            ->addColumn('update_time', 'integer', ['limit' => '11', 'signed' => '0', 'null' => '0', 'default' => '0', 'comment' => '', ])
            ->addColumn('delete_time', 'integer', ['limit' => '11', 'signed' => '0', 'null' => '0', 'default' => '0', 'comment' => '', ])
            ->addColumn('type', 'integer', ['limit' => '3', 'signed' => '0', 'null' => '0', 'default' => '0', 'comment' => '报价类型 {radio} (0:显卡报价,1:整机报价)', ])
            ->addColumn('title', 'string', ['limit' => '100', 'null' => '0', 'comment' => '报价名称', ])
            ->addColumn('price', 'double', ['null' => '0', 'comment' => '报价', ])
            ->addColumn('link', 'string', ['limit' => '100', 'null' => '0', 'default' => '', 'comment' => '报价链接', ])
            ->addColumn('desc', 'text', ['null' => '0', 'comment' => '配置说明 {textarea}', ])
            ->addColumn('desc_image', 'string', ['limit' => '100', 'null' => '0', 'comment' => '截图 {image}', ])
            ->addColumn('status', 'integer', ['limit' => '3', 'signed' => '0', 'null' => '0', 'default' => '1', 'comment' => '比价状态 {radio} (0:禁用,1:启用)', ])
            ->addColumn('gpu_id', 'biginteger', ['limit' => '20', 'signed' => '0', 'null' => '0', 'comment' => 'GPU {relation} (table:app_gpu,relationBindSelect:title)', ])
            ->addColumn('user_id', 'biginteger', ['limit' => '20', 'signed' => '0', 'null' => '0', 'comment' => '用户 {relation} (table:system_admin,relationBindSelect:username)', ])
            ->create();
    }
}
